package com.qinggeng.project.tool.pay.service;

import com.qinggeng.project.tool.pay.domain.WxWithdrawModal;
import com.qinggeng.project.tool.pay.domain.json.WxpayConfigJson;
import com.qinggeng.project.tool.pay.domain.vo.TradeVo;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

/**
 * 支付宝工具
 */
public interface WxPayService {

    /**
     * 处理来自PC的交易请求
     * @param tradeVo 交易详情
     * @return
     */
    public String toPayAsWeb(TradeVo tradeVo) throws Exception;

    /**
     * 处理来自手机网页的交易请求
     * @param tradeVo 交易详情
     * @throws Exception
     */
    public String toPayAsWap(TradeVo tradeVo) throws Exception;

    /**
     * 处理来自APP的交易请求
     * @param tradeVo 交易详情
     * @return /
     * @throws Exception
     */
    public String toPayAsApp(TradeVo tradeVo) throws Exception;

    /**
     * 处理来自扫码的交易请求
     * @param tradeVo 交易详情
     * @return /
     * @throws Exception
     */
    public String toPayAsScan(TradeVo tradeVo) throws Exception;


    /**
     * 处理来自公众号支付的交易请求
     * @param tradeVo 交易详情
     * @return /
     */
    public String toPayAsMp(TradeVo tradeVo) throws Exception;

    /**
     * 处理来自小程序支付的交易请求
     * @param tradeVo 交易详情
     * @return /
     */
    public String toPayAsMiniapp(TradeVo tradeVo)throws Exception;
    /**
     * 校验签名
     * @param rsa HttpServletRequest
     * @return /
     */
    public boolean rsaCheck(Map<String, String> rsa);

    /**
     * 回调
     * @param parameterMap 回调信息
     */
    public boolean notifyCallback(Map<String, String> parameterMap);

    /**
     * 获取配置信息
     * @return /
     */
    public WxpayConfigJson getConfig();

    /**
     * 退款
     * @param ordersNo 订单编号
     * @param refundAmount 退款金额
     */
    void refund(String ordersNo, BigDecimal refundAmount) throws Exception;

    /**
     * 单商品退款
     * @param ordersNo
     * @param ordersGoodsId
     * @param refundAmount
     * @throws Exception
     */
    String refund(String ordersNo, Long ordersGoodsId,BigDecimal refundAmount) throws Exception;

    boolean withdrawal(WxWithdrawModal modal);


    //代付
    String paymentOnBehalfOf (TradeVo tradeVo)throws Exception;



}
